package com.shujia.mr.demo2;

import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Reducer;

import java.io.IOException;

/*
    reduce的输入key-value类型实际上就是map的输出key-value类型
 */
public class MyReducer extends Reducer<LongWritable, Text,LongWritable, Text> {
    //每一个分组都会执行一次reduce逻辑

    @Override
    protected void reduce(LongWritable key, Iterable<Text> values, Reducer<LongWritable, Text, LongWritable, Text>.Context context) throws IOException, InterruptedException {
        for (Text value : values) {
            context.write(key,value);
        }

    }
}
